#define  _CRT_SECURE_NO_WARNINGS
class Solution {
    int sum = 0;
    void dfs(vector<int>& nums, int path = 0, int cut = -1)
    {
        sum += path;
        for (int i = cut + 1; i < nums.size(); i++)
            dfs(nums, (path ^ nums[i]), i);
    }
public:
    int subsetXORSum(vector<int>& nums) {
        dfs(nums);
        return sum;
    }
};